[LINUX] Mark /dev/mem regions as VM_PFNMAP.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 14 Aug 2006 15:35:49 +0000 (16:35 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 14 Aug 2006 15:35:49 +0000 (16:35 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c
linux-2.6-xen-sparse/mm/memory.c

index 775e0ef22d97add2eaf1c9c9d08416c280fed2d2..cb024992c3f1f1855659404e01127705d48887b0 100644 (file)
@@ -121,7 +121,7 @@ int direct_remap_pfn_range(struct vm_area_struct *vma,
                           domid_t  domid)
 {
        /* Same as remap_pfn_range(). */
-       vma->vm_flags |= VM_IO | VM_RESERVED;
+       vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
 
        if (domid == DOMID_SELF)
                return -EINVAL;
index 827a0a37a4cf94c9563e248b35b0586b0bc25b38..1a63339203cb4f609654eea3f815db1dee371adb 100644 (file)
@@ -390,7 +390,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_
 
        if (vma->vm_flags & VM_PFNMAP) {
                unsigned long off = (addr - vma->vm_start) >> PAGE_SHIFT;
-               if (pfn == vma->vm_pgoff + off)
+               if ((pfn == vma->vm_pgoff + off) || !pfn_valid(pfn))
                        return NULL;
                if (!is_cow_mapping(vma->vm_flags))
                        return NULL;
@@ -405,8 +405,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_
         * Remove this test eventually!
         */
        if (unlikely(!pfn_valid(pfn))) {
-               if (!(vma->vm_flags & VM_RESERVED))
-                       print_bad_pte(vma, pte, addr);
+               print_bad_pte(vma, pte, addr);
                return NULL;
        }